package com.game.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.game.common.utils.DateUtils;
import com.game.system.domain.game.GameDevice;
import com.game.system.mapper.GameDeviceMapper;
import com.game.system.service.IGameDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 游戏设备Service业务层处理
 *
 * @author Mr.Liu
 * @date 2025-03-18
 */
@Service
public class GameDeviceServiceImpl extends ServiceImpl<GameDeviceMapper, GameDevice> implements IGameDeviceService {
    @Autowired
    private GameDeviceMapper gameDeviceMapper;

    /**
     * 查询游戏设备
     *
     * @param id 游戏设备主键
     * @return 游戏设备
     */
    @Override
    public GameDevice selectGameDeviceById(String id) {

        return gameDeviceMapper.selectGameDeviceById(id);
    }

    /**
     * 查询游戏设备列表
     *
     * @param gameDevice 游戏设备
     * @return 游戏设备
     */
    @Override
    public List<GameDevice> selectGameDeviceList(GameDevice gameDevice) {
        return gameDeviceMapper.selectGameDeviceList(gameDevice);
    }

    /**
     * 新增游戏设备
     *
     * @param gameDevice 游戏设备
     * @return 结果
     */
    @Override
    public int insertGameDevice(GameDevice gameDevice) {
                gameDevice.setCreateTime(DateUtils.getNowDate());
            return gameDeviceMapper.insertGameDevice(gameDevice);
    }

    /**
     * 修改游戏设备
     *
     * @param gameDevice 游戏设备
     * @return 结果
     */
    @Override
    public int updateGameDevice(GameDevice gameDevice) {
                gameDevice.setUpdateTime(DateUtils.getNowDate());
        return gameDeviceMapper.updateGameDevice(gameDevice);
    }

    /**
     * 批量删除游戏设备
     *
     * @param ids 需要删除的游戏设备主键
     * @return 结果
     */
    @Override
    public int deleteGameDeviceByIds(String[] ids) {
        return gameDeviceMapper.deleteGameDeviceByIds(ids);
    }

    /**
     * 删除游戏设备信息
     *
     * @param id 游戏设备主键
     * @return 结果
     */
    @Override
    public int deleteGameDeviceById(String id) {
        return gameDeviceMapper.deleteGameDeviceById(id);
    }
}
